package com.lumyc.criteria;

import java.util.ArrayList;
import java.util.List;

public class CriteriaFemale implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        //定义女性数组
        List<Person> femalePersons = new ArrayList<>();

        //遍历参数数组
        for (Person person : persons ) {
            //如果性别为女则加入女性数组
            if(person.getGender().equalsIgnoreCase("female")){
                femalePersons.add(person);
            }
        }

        //返回女性数组
        return femalePersons;
    }
}
